/*
 * @作者: kerwin
 * @公众号: 大前端私房菜
 */

import React, { Component } from "react";

export default class App extends Component {
  a = 100;
  miref = React.createRef();  //严格模式下这样写
  render() {
    return (
      <div>
        {/* <input ref="mytext12"/> */}
        <input ref={this.miref} />
        <button
          onClick={() => {
            // console.log("click1",this.refs.mytext12.value)

            console.log("click", this.miref.current.value);
          }}
        >
          add1
        </button>

        <button onClick={this.handleClick2}>触发</button>
      </div>
    );
  }

  handleClick2 = () => {
    console.log("click2触发ref事件", this.miref.current.value);
  };
}
